<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
var intersection = function(nums1, nums2) {
    nums1 = new Set([...nums1])
    nums2 = new Set([...nums2])
    let nums3 = [...new Set([...nums1].filter(item => nums2.has(item)))]
    return nums3
};

var intersection = function(nums1, nums2) {
    return [...new Set(nums1)].filter(item => nums2.includes(item))
};
    </script>
</body>
</html>